import java.util.Scanner;

public class CronometroMod implements Runnable {
	static boolean isAlive = true;

	public void run() {
		int numSecondi = 1;

		while (isAlive) {
			try {
				Thread.sleep(1000);// inseririre mille per contare i secondi ecc
									// ecc
			} catch (InterruptedException e) {
				break;
			}
			System.out.println("\n" + numSecondi + " s");
			numSecondi++;

		}
	}

	public static void requestThreadStop() throws InterruptedException {
		Scanner s = new Scanner(System.in);
		isAlive = false;
		System.out.println("cron stopped");
	}

	public static void main(String[] args) throws InterruptedException {
		Scanner in = new Scanner(System.in);
		CronometroMod cronometro = new CronometroMod();
		System.out.println("Premi invio per cominciare");
		in.nextLine();

		cronometro.run();
		System.out.println("Premi invio per terminare");
		in.nextLine();
		requestThreadStop();

	}
}